package com.spider.demo;

import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        //目标：面向对象编程实现智能家居控制系统。
        JD[] jds = new JD[4];
        jds[0] = new WashMachine("海尔洗衣机",false);
        jds[1] = new Air("美的空调",false);
        jds[2] = new TV("Philips TV",true);
        jds[3] = new Lamp("LED灯泡",true);
        SmartHomeControl smarthomecontrol =SmartHomeControl.getInstance();
//      smarthomecontrol.control(jds[0]);
        while (true) {
            smarthomecontrol.printAllStatus(jds);
            System.out.println("请选择您要控制的设备：");
            Scanner choice =new Scanner(System.in);
            String c = choice.next();
            switch (c){
                case "1":
                    smarthomecontrol.control(jds[0]);
                    break;
                case "2":
                    smarthomecontrol.control(jds[1]);
                    break;
                case "3":
                    smarthomecontrol.control(jds[2]);
                    break;
                case "4":
                    smarthomecontrol.control(jds[3]);
                    break;
                case "exit":
                    System.out.println("退出系统！");
                    return;
                default:
                    System.out.println("输入错误！");
            }
        }
    }
}
